package com.my.study;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * 线程池队列满了以后，多余任务的拒绝策略，默认有4中：AbortPolicy、DiscardPolicy、DiscardOldestPolicy、CallerRunsPolicy
 */
public class UserRejectHandler implements RejectedExecutionHandler {

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        System.out.println("task reject=======" + executor.toString());
    }
}
